package cairmgon.business
{
	import com.adobe.cairngorm.business.ServiceLocator;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;

	public class HelloWorldDelegate
	{
		public final function HelloWorldDelegate(responder:IResponder)
		{
			this.responder = responder;
			this.service = ServiceLocator.getInstance().getRemoteObject("helloworldService");
		}
		//远程对象
		private var service:Object;
		//远程调用返回时的处理对象
		private var responder:IResponder;
		
		public function sayHello(myName:String):void{
			var call:AsyncToken = service.sayHello(myName);
			call.addResponder(responder);
		}
		
		public function getUserNameById(userId:int):void{
			var call:AsyncToken = service.getUserNameById(userId);
			call.addResponder(responder);
		}
	}
}